import Vue from "vue";
import Router from 'vue-router'
// import Home from '../components/Home'

Vue.use(Router)

export default new Router({
    routes:[
        {
            path:'/',
            redirect:'/users/login',
            hidden:true,
            component:()=>import('@/components/Login')
        },
        {
            path:'/users/login',
            name:'Login',
            hidden:true,
            meta: {
                isEsnRequired: true
            },
            component:()=>import('@/components/Login')
        },
        {
            path:'/register',
            name:'register',
            hidden:true,
            component:()=>import('@/components/Register')
        },
        {
            path: '/home',
            component:()=>import('@/views/MyAnimals'),
            //嵌套路由
            children: [
              {
                path: '/home/AnimalList',
                component:()=>import('@/views/HomePage/AnimalList')
              },
              {
                path: '/home',
                redirect: '/home/AnimalList'
              }
            ]
          },
          {
            path: '/center',
            component: () => import('@/views/MyCenter'),
            meta: {
              isEsnRequired: true
            }
          },
          {
            path: '/community',
            component: ()=>import('@/views/MyCommunity')
          },
        // {
        //     path:'*',
        //     redirect:'/users/login',
        //     component:()=>import('@/components/Login')
        // }
    ],
    mode:'history'
})